<%@ page import="com.oval.util.JspHelper" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="com.oval.util.FileWatchDog" %>

<% 
    List status = new ArrayList();
    String actionname = request.getParameter("actionname")==null ? "" :(String)request.getParameter("actionname");
    if(actionname.equals("check"))
    {
      FileWatchDog watcher = FileWatchDog.getInstance();
      status = watcher.checkStatus();
    }
    if(actionname.equals("upload"))
    {
      String[] uploadfiles = request.getParameterValues("filename");
      FileWatchDog watcher = FileWatchDog.getInstance();
      watcher.upload(uploadfiles);
      status = watcher.checkStatus();
    }
    
%>
<html>
<head>
<title></title>
<script>
function refresh()
{
  document.cform.actionname.value = "check";
  document.cform.submit(); 
}

function upload()
{
  document.cform.actionname.value = "upload";
  document.cform.submit();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/chinese/csscontent.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="cform" method="post" action="showchanges.jsp">
<input type="hidden" name="actionname" value="upload">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="images/chinese/title_bg.gif"><img src="images/chinese/title_bg.gif" width="3" height="29"></td>
  </tr>
</table>

<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#999999">
  <tr> 
    <td colspan="3" class="td_title_bg">
      <img src="images/chinese/arrow2.gif">Changed File</img>
    </td>
  </tr>
  <tr class="td_bg_row">
    <td class="td_center">&nbsp;</td>
    <td class="td_center">FileName</td>
    <td class="td_center">Status</td>
  </tr>
 <% 
    for(int i=0 ; i<status.size() ; i++ )
    {
      String[] fileStatus = (String[])(status.get(i));
 %>
  <tr class="td_bg1">
    <td class="td_center"><input type="checkbox" name="filename" value="<%=JspHelper.filterNull( fileStatus[0] )%>" ></td>
    <td class="td_center"><%=JspHelper.filterNull( fileStatus[0] )%></td>
    <td class="td_center"><%=JspHelper.filterNull( fileStatus[1] )%></td>
  </tr>
 <% } %>
 
 <tr class="td_bg1">
    <td class="td_center" colspan="3">
        <INPUT TYPE="button" onclick="javascript:upload()" value="UpLoad">
        <INPUT TYPE="button" onclick="javascript:refresh()" value="ReFresh">
    </td> 
 </tr>
</table>

</body>
</html>

